<?
//--updated 22.04.2005 15:56 --
//--updated 22.04.2005 15:29 --
//--updated 06.04.2005 10:41 --

if ($_SESSION["adminmode"]){
echo "
<style>
img.small_icon_16 {width: 16px;height: 16px;border: solid 0px black;}
</style>";

$ls=shell_exec("ls mods/*.php|sort");
$lsa=explode("\n",$ls);
{

echo "<h3>Modules</h3>
<table cellspacing=1 class=tablecontent cellpadding=1 >";
echo "<tr><td><a href=index.php?mod=editmod&modname=noname>New module</a></td><td>Edit</td><td>Drop</td>
<td><a href=index.php?mod=editmod&modname=noname>New module</a></td><td>Edit</td><td>Drop</td>
<td><a href=index.php?mod=editmod&modname=noname>New module</a></td><td>Edit</td><td>Drop</td></tr>";

for ($i=0;$i<count($lsa);$i++)
{
$a=preg_replace('/.*\/(\w*)\.php/','$1',$lsa[$i]);
//$a=preg_replace('/.*\/(\w*))/','$1',$a);

if ($i % 3==0) echo "<tr>";
echo "<td ><a href=index.php?mod=$a class=middlelink>$a</a></td>
<td style='background-color: #e0ffe0'><a href=index.php?mod=editmod&modname=$a ><img src=.img/neworder.gif class=small_icon_16></a></td>
<td style='background-color: #ffe0e0'>
<a href=index.php?mod=dropmod&modname=$a  class=middlelink  onClick='return window.confirm(\"Delete module?\");'><img src=.img/del.gif class=small_icon_16></a></td>";
if ($i % 3==2) echo "</tr>";
}

echo "</table>";
}


$ls=shell_exec("ls script/*.php|sort");
$lsa=explode("\n",$ls);
{

echo "<h3>Scripts</h3>
<table cellspacing=1 class=tablecontent cellpadding=1 >";
echo "<tr><td><a href=index.php?mod=editmod&modname=../script/noname>New module</a></td><td>Edit</td>
<td><a href=index.php?mod=editmod&modname=../script/noname>New module</a></td><td>Edit</td>
<td><a href=index.php?mod=editmod&modname=../script/noname>New module</a></td><td>Edit</td></tr>";

for ($i=0;$i<count($lsa);$i++)
{
$a=preg_replace('/.*\/(\w*)\.php/','$1',$lsa[$i]);
//$a=preg_replace('/.*\/(\w*))/','$1',$a);

if ($i % 3==0) echo "<tr>";
echo "<td ><a href=s.php?s=$a class=middlelink>$a</a></td>
<td style='background-color: #e0ffe0'><a href=index.php?mod=editmod&modname=../script/$a ><img src=.img/neworder.gif class=small_icon_16></a></td>";
if ($i % 3==2) echo "</tr>";
}

echo "</table>";
}


$ls=shell_exec("ls *.php|sort");
$lsa=explode("\n",$ls);
{

echo "<h3>Other files</h3>
<table cellspacing=1 class=tablecontent cellpadding=1 >";
echo "<tr><td><a href=index.php?mod=editmod&modname=../noname>New module</a></td><td>Edit</td>
<td><a href=index.php?mod=editmod&modname=../noname>New module</a></td><td>Edit</td>
<td><a href=index.php?mod=editmod&modname=../noname>New module</a></td><td>Edit</td></tr>";

for ($i=0;$i<count($lsa);$i++)
{
$a=preg_replace('/\.php/','',$lsa[$i]);
//$a=preg_replace('/.*\/(\w*))/','$1',$a);

if ($i % 3==0) echo "<tr>";
echo "<td ><a href=s.php?s=$a class=middlelink>$a</a></td>
<td style='background-color: #e0ffe0'><a href=index.php?mod=editmod&modname=../$a ><img src=.img/neworder.gif class=small_icon_16></a></td>";
if ($i % 3==2) echo "</tr>";
}

echo "</table>";
}


}

?>
